package dataBase;


import java.util.Iterator;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;



@SuppressWarnings("deprecation")
public class Main {

@SuppressWarnings("unchecked")
public static void main(String[] args) {
/*
 SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
 Session session = sessionFactory.openSession();

 Query query = session.createQuery("from User");

 List <User>list = query.list();
 Iterator<User> it=list.iterator();

// while (it.hasNext()){
  user=it.next();
  System.out.println("id: \t\t"+user.getUserName());
//  System.out.println("age: \t\t"+user.getAge());
//  System.out.println("first name: \t"+user.getFirstName());
//  System.out.println("last name: \t"+user.getLastName());
//  System.out.println("email: \t\t"+user.getEmail());
*/
	
	
	
	
	
 User user=new User();
 user.setUserName("noahakim@gmail.com");
 user.setPassword("Frog");
 DataBaseCommand db=new DataBaseCommand();
 db.addUser(user);
 Folder fol=new Folder();
 fol.setName("noa");
 db.addFolder(user, fol);
// db.deleteUser("noahakim@gmail.com");
 db.clearDataBase();
 
 
 
 
 
//add folder to user
// fol.setUserName(user.getUserName());

// fol.setPath("c:/noa");
// user.getFolders().add(fol);
//fol=user.getFolders().
/* Query query2 = session.createQuery("from Folder");
 List <Folder>list2 = query2.list();
 Iterator<Folder> it2=list2.iterator();
 Folder fol=it2.next();
 
//  Share share=new Share();
//  share.setCode(1);
//  share.setShareWith(it.next().getUserName());
//  fol.getPartners().add(share);
 
 File file=new File();
 file.setName("newfile");
 file.setPath(fol.getPath());
 file.setType("doc");
 file.setUserName(fol.getUserName());
 fol.getFiles().add(file);
  FolderManager folManager = new FolderManager(session);
*/
 //folManager.updateFolder(fol);
 //System.out.println("User saved with ID = "+ fol.getName());

// session.flush();
// session.close();
 }
}
